<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>商家内页</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../css/aui-flex.css"/>
    <link rel="stylesheet" type="text/css" href="../css/aui-slide.css"/>
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../css/aui-flex.css"/>
    <style type="text/css">
        body {
            font-size: 14px;
        }

        .aui-icon-locationfill, .aui-icon-attentionfill, .aui-iconfont {
            color: #ccc !important;
            margin: 0 !important;
        }

        .aui-iconfont.active {
            color: #ff3333 !important;
        }

        .aui-img-body > .aui-ellipsis-1 {
            /*height: 30px;*/
            font-size: 12px;
        }

        .aui-list-view-cell > a {
            padding: 0;
        }

        .headerDiv {
            position: relative;
            height: 400px;
        }

        .shopInfo {
            position: absolute;
            bottom: 0;

        }
    </style>
</head>
<body>
<header>
    <div class="slide">
        <div id="aui-slide">
            <div class="aui-slide-wrap">
                <div class="aui-slide-node ">
                    <img src="../image/index3.jpg"/>
                </div>
                <div class="aui-slide-node ">
                    <img src="../image/index3.jpg"/>
                </div>
                <div class="aui-slide-node ">
                    <img src="../image/index3.jpg"/>
                </div>
            </div>
            <div class="aui-slide-page-wrap"><!--分页容器--></div>
        </div>
    </div>
</header>

<div class=" contain supplierList " id="supplierInfo-content">
</div>
<div class=" " id="supplierGoodList-content">

</div>
<script id="supplierInfo-template" type="text/x-dot-template">
    <ul class="aui-list-view">
        <li class="aui-list-view-cell aui-img">
            <div class="aui-img-body">
                <div class="aui-ellipsis-1">{{=it.supplier_name}}</div>
                <p class="dispalyNone">
                    <span class="view aui-col-xs-4">
                         <i class="aui-iconfont aui-icon-attentionfill"></i>
                        {{=it.click_count}}
                    </span>
                    <span class="location aui-col-xs-8">
                        <i class="aui-iconfont aui-icon-locationfill"></i>
                            37.23km{{=it.supplier_name}}
                    </span>
                </p>
            </div>
        </li>
        <li class="aui-list-view-cell aui-img aui-flex-col dispalyNone" tapmode>
            <div class="aui-flex-item-10   aui-flex-col aui-padded-0-5">
                <i class="aui-iconfont aui-icon-locationfill aui-pull-left aui-flex-item-2"
                   style="font-size: 30px;"></i>
                <div class="aui-img-body aui-flex-item-10">
                    <div class="aui-ellipsis-3 fz12 ">{{=it.address}}</div>
                </div>
            </div>
            <span class="aui-iconfont aui-text-center aui-pull-left aui-flex-item-2 aui-border-l"
                  style="font-size: 30px;line-height: 24px;">
                <img src="../image/weizhi.png">
                <p>295km</p>
            </span>
        </li>
        <li class="aui-list-view-cell aui-img aui-flex-col dispalyNone">

            <div class="aui-flex-item-10   aui-flex-col">
                <i class="aui-iconfont aui-icon-phone aui-pull-left aui-flex-item-2" style="font-size: 30px;"></i>
                <div class="aui-img-body aui-flex-item-10 aui-flex-row aui-flex-middle">
                    <div class="aui-ellipsis-3 fz12 ">{{=it.contacts_phone}}</div>
                </div>
            </div>
            <a href="tel:{{=it.contacts_phone}}"
               class="aui-iconfont aui-text-center aui-pull-left aui-icon-phone active aui-flex-item-2 aui-border-l"
               style="font-size: 30px;">
            </a>

        </li>

        <li class="aui-list-view-cell aui-img">
            <div class="supplierIntrolTile ">商家介绍</div>
            <p class="aui-img-body">
                {{=it.company_name}}
                <!--广州爱奖励平台位于中国广东广州市天河区中石化大厦的六楼这个是长标题-->
            </p>
        </li>
    </ul>

</script>


<script id="supplierGoodList-template" type="text/x-dot-template">


    <!--<ul class="aui-waterfall" id="aui-waterfall">-->
    <!--{{ for(var i in it){ }}-->
    <!--<li tapmode onclick="goToGoodInfo('{{=it[i].goods_id}}')">-->
    <!--<div class="aui-waterfall-header">-->
    <!--<img src="{{=it[i].goods_img}}"/>-->
    <!--</div>-->
    <!--<div class="aui-waterfall-body">-->
    <!--{{=it[i].goods_name}}-->
    <!--</div>-->
    <!--<div class="aui-waterfall-footer">-->
    <!--<span class="aui-text-info">-->
    <!--{{=it[i].shop_price}}-->
    <!--</span>-->
    <!--<span class="aui-pull-right">-->
    <!--<span class="font-size-12 font-weight-700 aui-pull-right aui-padded-r-10">已卖：{{=it[i].sales_volume_base}}</span>-->
    <!--</span>-->
    <!--</div>-->
    <!--</li>-->
    <!--{{}}}-->
    <!--</ul>-->


    <ul class="aui-list-view odd-right-even-left-2 ">
        {{ for(var i in it){ }}
        <li class="aui-list-view-cell aui-img aui-col-xs-6 img100 aui-margin-b-15 aui-padded-b-10 aui-border-b aui-padded-0"
            tapmode onclick="goToGoodInfo('{{=it[i].goods_id}}')">
            <img class="" src="{{=it[i].goods_img}}">
            <div class="aui-padded-0-10">
                <p class="aui-ellipsis-2  font-black-12" style="height: 33px">{{=it[i].goods_name}}</p>
                <p class="aui-margin-t-5">
                    <span class="aui-text-danger font-size-12 font-weight-700">{{=it[i].shop_price}}</span>
                    <span class="font-size-12 font-weight-700 aui-pull-right aui-padded-r-10">已卖：{{=it[i].sales_volume_base}}</span>
                </p>
            </div>
        </li>
        {{}}}
    </ul>
</script>
</body>


<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/myInfo.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript" src="../script/echo.js"></script>
<script type="text/javascript" src="../script/jquery-1.11.3.js"></script>
<script type="text/javascript" src="../script/aui-slide.js"></script>
<script type="text/javascript" src="../script/aui-waterfall.js"></script>
<script type="text/javascript">
    var page = 1, isLock = false, type = 1, supplierId = "";
    var companyData;
    var module = 'index';
    apiready = function () {
        api.parseTapmode();
        getStorageAll();
        supplierId = api.pageParam.supplierId;
        companyData = api.pageParam.companyData;
        getSupplierInfo();
        getSupplierGoodList();
//        getSupplierForId(supplierId);
        api.addEventListener({
            name: 'scrolltobottom'
        }, function (ret, err) {
            page++;
            if (isLock == false) {
                getSupplierGoodList();
            }
        })

        // showData(type,module);
//            api.refreshHeaderLoading();

        $aui.waterfall($api.byId("aui-waterfall"), {
            col: 2,//列数
            padding: 10,//容器内边距
            space: 10//列间距
        });
    }
    $(function () {
        slide();
    })
    function slide() {
        var slide3 = new auiSlide({
            container: document.getElementById("aui-slide"),
            // "width":300,
            "height": 180,
            "speed": 500,
            "autoPlay": 3000, //自动播放
            "loop": true,
            "pageShow": true,
            "pageStyle": 'dot',
            'dotPosition': 'center'
        })
    }
    function getSupplierInfo() {
        showLoading()
        var url = "supplier/info";
        var data = {};
        data["supplier_id"] = supplierId;
        getStorageAll();
//        alert(JSON.stringify(data))
        ajaxRequest(url, 'get', data, function (ret, err) {
//        alert(JSON.stringify(ret.data.company_name))
            hideLoading();
            var content = $api.byId('supplierInfo-content');
            var tpl = $api.byId('supplierInfo-template').text;
            var tempFn = doT.template(tpl);
//            if (page > 1) {
//                if (!$.trim(ret.data)) {
//                    return;
//                }
//                $api.append(content, tempFn(ret.data));
//            } else {
//                showNoTip(ret.data);
//
//            }
//            $api.html(content, tempFn(ret.data));
            $api.html(content, '');
            $api.html(content, tempFn(ret.data));
            api.execScript({
                name: "shopInfo_win",
                script: "addSupplierPhone('" + ret.data.contacts_phone + "')"
            })
        });
    }
    function getSupplierGoodList() {
        showLoading()
        var url = "goods/list";
        var data = {};
        data["supplier_id"] = supplierId;
        data["page"] = page;
        data["count"] = 10;
        getStorageAll();
//        alert(JSON.stringify(data))
        ajaxRequest(url, 'get', data, function (ret, err) {
//        alert(JSON.stringify(ret.data.company_name))
            hideLoading();
            var content = $api.byId('supplierGoodList-content');
            var tpl = $api.byId('supplierGoodList-template').text;
            var tempFn = doT.template(tpl);

            if (page > 1) {
                if (!$.trim(ret.data)) {
                    isLock = true;
                    return;
                }
                $api.append(content, tempFn(ret.data));
            } else {
                if (!$.trim(ret.data)) {
                    isLock = true;
                    showNoTip(ret.data);
                }
                $api.html(content, tempFn(ret.data));
            }

//            $api.html(content, '');
//            $api.html(content, tempFn(ret.data));
//            $aui.waterfall($api.byId("aui-waterfall"), {
//                col: 2,//列数
//                padding: 10,//容器内边距
//                space: 10//列间距
//            });

        });
    }
</script>
</html>